﻿@page
@using Microsoft.AspNetCore.Authorization
@using Volo.Abp.AspNetCore.Mvc.UI.Layout
@using Volo.Docs.Admin
@using Volo.Docs.Admin.Navigation
@using Microsoft.AspNetCore.Mvc.Localization
@using Volo.Docs.Localization
@model Volo.Docs.Admin.Pages.Docs.Admin.Projects.IndexModel
@inject IHtmlLocalizer<DocsResource> L
@inject IAuthorizationService Authorization
@{
    ViewBag.PageTitle = "Projects";
}
@inject IPageLayout PageLayout
@{
    PageLayout.Content.Title = L["Projects"].Value;
    PageLayout.Content.BreadCrumb.Add(L["Menu:DocumentManagement"].Value);
    PageLayout.Content.MenuItemName = DocsMenuNames.Projects;
}

@section scripts {
    <abp-script src="/client-proxies/docs-admin-proxy.js" />
    <abp-script src="/client-proxies/docs-common-proxy.js" />
    <abp-script src="/Pages/Docs/Admin/Projects/index.js" />
    <abp-script src="/Pages/Docs/Admin/Projects/create.js" />
    <abp-script src="/Pages/Docs/Admin/Projects/edit.js" />
    <abp-script src="/Pages/Docs/Admin/Projects/pull.js" />
    <abp-script src="/Pages/Docs/Admin/Projects/managePdfFiles.js" />
    <abp-script src="/Pages/Docs/Admin/Projects/generatePdf.js" />
}

<abp-card>
    <abp-card-header>
        <abp-row>
            <abp-column size-md="_12" class="text-end">
                @if (await Authorization.IsGrantedAsync(DocsAdminPermissions.Projects.Create))
                {
                    <abp-dropdown>
                        <abp-dropdown-button button-type="Primary" icon="plus" text="@L["CreateANewProject"].Value" />
                        <abp-dropdown-menu align="End">
                            <abp-dropdown-item href="#" id="CreateNewGithubProjectButtonId"><i class="fa fa-github"></i> GitHub</abp-dropdown-item>
                        </abp-dropdown-menu>
                    </abp-dropdown>
                }
                @if (await Authorization.IsGrantedAsync(DocsAdminPermissions.Projects.Default))
                {
                    <abp-button button-type="Primary" icon="plus" text="@L["ReIndexAllProjects"].Value" id="ReIndexAllProjects" />
                }
            </abp-column>
        </abp-row>
    </abp-card-header>
    <abp-card-body>
        <abp-table  id="ProjectsTable" class="nowrap">
            <thead>
                <tr>
                    <th>@L["Actions"]</th>
                    <th>@L["Name"]</th>
                    <th>@L["ShortName"]</th>
                    <th>@L["DocumentStoreType"]</th>
                    <th>@L["Format"]</th>
                </tr>
            </thead>
        </abp-table>
    </abp-card-body>
</abp-card>
